<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>教学工作量申报</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="../css/common_impt.css">
    <link rel="stylesheet" href="../css/apply.css">

</head>
<body>
<div id="top"></div>
<div id="left"></div>

<div id="right">
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">教学岗位聘用申报</a></li>
            <li><a href="#">教学工作量申报</a></li>
        </ul>
        <span>教学工作量得分：</span>
    </div>

    <div class="mainindex">

        <div class="item_box">
            <h4>1.基本教学工作量</h4>
            <ul id="baseWorks" class="item_box_list">
                <li>
                    <p>
                        (<span class="item_num">1</span>) 学期：
                        <select class="termSelect">
                            <option name="term" value="">--请选择--</option>
                            <option value="N18">2018-2019学年春季学期</option>
                            <option value="P18">2018-2019学年秋季学期</option>
                            <option value="N17">2017-2018学年春季学期</option>
                            <option value="P17">2017-2018学年秋季学期</option>
                            <option value="N16">2016-2017学年春季学期</option>
                            <option value="P16">2016-2017学年秋季学期</option>
                        </select>
                    </p>
                    <p>
                        该学期需要完成的基本教学工作量是 <input type="text" class="totalWorks" readonly>学时，选择该学期基本教学工作量的完成度：
                        <select class="finish">
                            <option value="">-- 请选择 --</option>
                            <option value="1">已完成</option>
                            <option value="0">未完成</option>
                        </select>
                    </p>
                    <p>
                        <label>备注：</label>
                        <input class="remark" type="text"/>
                    </p>
                </li>
            </ul>
            <div class="add_btn">
                <span>添加一项</span>
            </div>
        </div><!--1.基本教学工作量-->

        <div class="item_box">
            <h4>2.理论课教学工作量</h4>
            <ul id="theoryWorks" class="item_box_list">
                <li>
                    <p>
                        (<span class="item_num">1</span>)学期：
                        <select class="termSelect">
                            <option value="">--请选择--</option>
                            <option name="term" value="">--请选择--</option>
                            <option value="N18">2018-2019学年春季学期</option>
                            <option value="P18">2018-2019学年秋季学期</option>
                            <option value="N17">2017-2018学年春季学期</option>
                            <option value="P17">2017-2018学年秋季学期</option>
                            <option value="N16">2016-2017学年春季学期</option>
                            <option value="P16">2016-2017学年秋季学期</option>
                        </select>
                    </p>
                    <p>
                        课程名称：<input class="className" type="text"/>
                        学时：<input class="period" type="text"/>
                    </p>
                    <p>
                        <label>课程系数：</label>
                        <select class="classCategory">
                            <option value="">--请选择--</option>
                            <option value="THEORY">理论课</option>
                            <option value="PRACTICE">实践课</option>
                            <option value="DISSECTION">实践课解剖</option>
                            <option value="SPORT">实践课体育</option>
                            <option value="OPTIONAL">选修课</option>
                        </select>
                        <label>备注：</label>
                        <input class="remark" type="text"/>
                    </p>
                </li>
            </ul>
            <div class="add_btn">
                <span>添加一项</span>
            </div>
        </div><!--2.理论课教学工作量-->

        <div class="item_box">
            <h4>3.实践课教学工作量</h4>
            <ul id="practiceWorks" class="item_box_list">
                <li>
                    <p>
                        (<span class="item_num">1</span>)学期：
                        <select class="termSelect">
                            <option value="">--请选择--</option>
                            <option name="term" value="">--请选择--</option>
                            <option value="N18">2018-2019学年春季学期</option>
                            <option value="P18">2018-2019学年秋季学期</option>
                            <option value="N17">2017-2018学年春季学期</option>
                            <option value="P17">2017-2018学年秋季学期</option>
                            <option value="N16">2016-2017学年春季学期</option>
                            <option value="P16">2016-2017学年秋季学期</option>
                        </select>
                    </p>
                    <p>
                        课程名称：<input class="className" type="text"/>
                        学时：<input class="period" type="text"/>
                    </p>
                    <p>
                        <label>课程系数：</label>
                        <select class="classCategory">
                            <option value="">--请选择--</option>
                            <option value="THEORY">理论课</option>
                            <option value="PRACTICE">实践课</option>
                            <option value="DISSECTION">实践课解剖</option>
                            <option value="SPORT">实践课体育</option>
                            <option value="OPTIONAL">选修课</option>
                        </select>
                        <label>备注：</label>
                        <input class="remark" type="text"/>
                    </p>
                </li>
            </ul>
            <div class="add_btn">
                <span>添加一项</span>
            </div>
        </div><!--3.实践课教学工作量-->

        <div class="item_box">
            <h4>4.选修课教学工作量</h4>
            <ul id="optionalWorks" class="item_box_list">
                <li>
                    <p>
                        (<span class="item_num">1</span>)学期：
                        <select class="termSelect">
                            <option value="">--请选择--</option>
                            <option name="term" value="">--请选择--</option>
                            <option value="N18">2018-2019学年春季学期</option>
                            <option value="P18">2018-2019学年秋季学期</option>
                            <option value="N17">2017-2018学年春季学期</option>
                            <option value="P17">2017-2018学年秋季学期</option>
                            <option value="N16">2016-2017学年春季学期</option>
                            <option value="P16">2016-2017学年秋季学期</option>
                        </select>
                    </p>
                    <p>
                        课程名称：<input class="className" type="text"/>
                        学时：<input class="period" type="text"/>
                    </p>
                    <p>
                        <label>课程系数：</label>
                        <select class="classCategory">
                            <option value="">--请选择--</option>
                            <option value="THEORY">理论课</option>
                            <option value="PRACTICE">实践课</option>
                            <option value="DISSECTION">实践课解剖</option>
                            <option value="SPORT">实践课体育</option>
                            <option value="OPTIONAL">选修课</option>
                        </select>
                        <label>备注：</label>
                        <input class="remark" type="text"/>
                    </p>
                </li>
            </ul>
            <div class="add_btn">
                <span>添加一项</span>
            </div>
        </div><!--4.选修课教学工作量-->

    </div>
    <div class="footer">
        <ul>
            <li id="saveInfoBtn">完成并上报</li>
            <li id="preSaveInfoBtn">预存信息</li>
            <li id="previewBtn">预览申报信息</li>
            <li>导出申报表格</li>
            <li id="nextBtn">下一项</li>
        </ul>
    </div>

</div>
<script type="text/javascript" src="../js/jquery-1.12.4.js"></script>
<script src="../js/public.js"></script>
<script src="../js/operation/apply.js"></script>
<script>
    $(function () {
        $("#top").load('top.html');
        $("#left").load('teacher_left.html',function () {
            menuActive(1,0);
        });

        $("#nextBtn").click(function () {
            window.location = 'tea_apply_study.html';
        })

        var userId = sessionStorage.getItem('userId');
        var worksList = null;
        requests.postReq(urls.worksList,JSON.stringify({'userId':userId}),function (data) {
            if(data.status == 1){
                worksList = data.data;
            }else{
                showTip('页面初始化失败，请刷新');
            }
        },null);
        // $("#baseWorks").on('change','.termSelect',function () {
        $("#baseWorks .termSelect").change(function () {
            var thisTerm = $(this).val();
            for(var key in termYear){
                if(key == thisTerm){
                    for(var i=0; i<worksList.length; i++){
                        if(worksList[i].schoolYear == termYear[key].year && worksList[i].semester == termYear[key].term){
                            $(this).parents('li').find('.totalWorks').val(worksList[i].workloadQuantity);
                        }
                    }
                }
            }
        });

        function saveWorks(){
            getDomData('worksApply','baseWorks',['termSelect','totalWorks','finish','remark']);//基本教学
            getDomData('worksApply','theoryWorks',['termSelect','className','period','classCategory','remark']);//理论课教学
            getDomData('worksApply','practiceWorks',['termSelect','className','period','classCategory','remark']);//实践课教学
            getDomData('worksApply','optionalWorks',['termSelect','className','period','classCategory','remark']);//选修课教学
        }

        var applyParam = {
            userId: userId,
            applyMessage: submitParam
        }
        //点击申报
        $("#saveInfoBtn").click(function () {
            saveWorks();
            applyParam.draft = 1;
            requests.postReq(urls.applyApy,JSON.stringify(applyParam),function (data) {
                if(data.status == 1){
                    showTip('申报成功',function () {
                        localStorage.setItem('scores',JSON.stringify(data.data));
                        window.open('preview.html');
                    });
                }
            })
        })
        //点击预存信息
        $("#preSaveInfoBtn").click(function () {
            saveWorks();
            applyParam.draft = 0;
            requests.postReq(urls.applyApy,JSON.stringify(applyParam),function (data) {
                if(data.status == 1){
                    showTip('信息保存成功',function () {
                        localStorage.setItem('scores',JSON.stringify(data.data));
                        window.open('preview.html');
                    });
                }
            })
        })
        //点击预览
        $("#previewBtn").click(function () {
            saveWorks();
            applyParam.draft = 2;
            requests.postReq(urls.applyApy,JSON.stringify(applyParam),function (data) {
                if(data.status == 1){
                    localStorage.setItem('scores',JSON.stringify(data.data));
                    window.open('preview.html');
                }
            })
        })

    })

</script>
</body>
</html>
